home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / AIncludes / Editions.a < prev    next >
Encoding:
Text File  |  1992-01-29  |  11.3 KB  |  487 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:            Editions.a
  3. ;
  4. ;    Contains:        Assembly Interface for Edition Manager 
  5. ;
  6. ;    Copyright:        © 1990-1991 by Apple Computer, Inc., all rights reserved.
  7. ;
  8. ;--------------------------------------------------------------------
  9.  
  10.  
  11.  
  12.     IF &TYPE('__IncludingEditions__') = 'UNDEFINED' THEN
  13. __IncludingEditions__    SET    1
  14.  
  15.     IF &TYPE('__IncludingTraps__') = 'UNDEFINED' THEN       ; get defintion of _PACK11
  16.     INCLUDE 'Traps.a'
  17.     ENDIF
  18.  
  19.     IF &TYPE('__IncludingFSEqu__') = 'UNDEFINED' THEN        ; get definition of FSSpec
  20.     INCLUDE     'FSEqu.a'
  21.     ENDIF
  22.  
  23.  
  24. ; resource types 
  25. rSectionType                EQU     'sect'
  26.  
  27. ; section types 
  28. stSubscriber                EQU     $01
  29. stPublisher                 EQU     $0A
  30.  
  31. ; Update Modes 
  32. sumAutomatic                EQU        0    ; subscriber update mode - Automatically 
  33. sumManual                    EQU        1    ; subscriber update mode - Manually 
  34. pumOnSave                    EQU        0    ; publisher update mode - On Save 
  35. pumManual                    EQU        1    ; publisher update mode - Manually 
  36.     
  37. ; EditionContainer subpart usage 
  38. kPartsNotUsed                EQU         0
  39. kPartNumberUnknown            EQU        -1
  40.  
  41. ; preview size 
  42. kPreviewWidth                EQU        120
  43. kPreviewHeight                EQU        120
  44.  
  45. ; special formats 
  46. kPublisherDocAliasFormat    EQU        'alis'     ; same as rAliasType
  47. kPreviewFormat                EQU        'prvw'
  48. kFormatListFormat            EQU        'fmts'
  49.  
  50. ; bits for formatsMask 
  51. kPICTformatMask                EQU        1
  52. kTEXTformatMask                EQU        2
  53. ksndFormatMask                EQU        4
  54.  
  55. ; Finder types for edition files 
  56. kPICTEditionFileType        EQU        'edtp'
  57. kTEXTEditionFileType        EQU        'edtt'
  58. ksndEditionFileType            EQU        'edts'
  59. kUnknownEditionFileType        EQU        'edtu'
  60.  
  61. ; pseudo-item hits for dialogHooks 
  62. ; the first is for NewPublisher or NewSubscriber Dialogs 
  63. emHookRedrawPreview            EQU     150
  64. ; the following are for SectionOptions Dialog 
  65. emHookCancelSection            EQU        160    
  66. emHookGoToPublisher            EQU        161
  67. emHookGetEditionNow            EQU        162
  68. emHookSendEditionNow        EQU        162
  69. emHookManualUpdateMode        EQU        163
  70. emHookAutoUpdateMode        EQU        164
  71.  
  72.  
  73. ; the refcon field of the dialog record in a modalfilter or 
  74. ; dialoghook during SectionOptionsDialog contains one the following 
  75. emOptionsDialogRefCon        EQU        'optn'
  76. emCancelSectionDialogRefCon    EQU        'cncl'
  77. emGoToPubErrDialogRefCon    EQU        'gerr'
  78.  
  79.  
  80. ; misc 
  81. kFormatLengthUnknown        EQU        -1
  82.  
  83.  
  84. ; record definitions
  85. ;
  86. SectionRecord    RECORD    0
  87. version            DS.B    1    ;    SignedByte         { always 1 in 7.0 release }
  88. kind            DS.B    1    ;    SectionType        { publisher or subscriber }
  89. mode            DS.W    1    ;    UpdateMode         { auto or manual }
  90. mdDate             DS.L    1    ;    TimeStamp        { version of data in section }
  91. sectionID        DS.L    1    ;    LONGINT            { application specific, unique per document }
  92. refCon             DS.L    1    ;    LONGINT            { application specific }
  93. alias            DS.L    1    ;    AliasHandle        { handle to Alias Record }
  94. ; the following fields are private and set up by RegisterSection 
  95. subPart            DS.L    1    ;    LONGINT            { which part of container,  always kPartsNotUsed in 7.0 }
  96. nextSection        DS.L    1    ;    SectionHandle    { for linked list of app's Sections }
  97. controlBlock    DS.L    1    ;    Handle            { shared controlblock for this section. }
  98. refNum             DS.L    1    ;    EditionRefNum    { NIL outside of Open/CloseEdition }
  99. size            EQU        *
  100.                 ENDR
  101.  
  102.  
  103. EditionContainerSpec RECORD 0
  104. theFile                DS        FSSpec                ;
  105. theFileScript        DS.W    1                    ;    ScriptCode
  106. thePart                DS.L    1                    ;    LONGINT
  107. thePartName            DS.B    32                    ;    Str31
  108. thePartScript        DS.W    1                    ;    ScriptCode
  109. size                EQU        *
  110.                     ENDR        
  111.  
  112.  
  113. EditionInfoRecord    RECORD 0
  114. crDate                DS.L    1                     ;     Timestamp        { date EditionContainer was created }
  115. mdDate                DS.L    1                     ;     Timestamp        { date of last change }
  116. fdCreator            DS.B    4                     ;     OSType            { file creator }
  117. fdType                DS.B    4                     ;     OSType         { file type, 'edtT', etc }
  118. container            DS        EditionContainerSpec ;                    { the Edition }
  119. size                EQU        *
  120.                     ENDR
  121.  
  122. NewPublisherReply    RECORD 0
  123. canceled            DS.B    1                     ;    BOOLEAN            { O }
  124. replacing            DS.B    1                     ;    BOOLEAN            { O }    
  125. usePart                DS.B    1                     ;    BOOLEAN            { I }
  126. pad1                DS.B    1                     ;    
  127. preview                DS.L    1                     ;    Handle             { I }
  128. previewFormat        DS.B    4                     ;    FormatType         { I }
  129. container            DS        EditionContainerSpec ;                    { I/O }
  130. size                EQU        *
  131.                     ENDR
  132.  
  133. NewSubscriberReply    RECORD 0
  134. canceled            DS.B    1                     ;    BOOLEAN            { O }
  135. formatsMask            DS.B    1                     ;    SignedByte        { I }
  136. container            DS        EditionContainerSpec ;                    { I/O }
  137. size                EQU        *
  138.                     ENDR
  139.  
  140. SectionOptionsReply RECORD 0
  141. canceled            DS.B    1                    ;    BOOLEAN            { O }
  142. changed                DS.B    1                    ;    BOOLEAN            { O }
  143. sectionH            DS.L    1                    ;    SectionHandle    { I }
  144. action                DS.B    4                    ;     ResType            { 0 }
  145. size                EQU        *
  146.                     ENDR
  147.  
  148.  
  149. ; FormatIOVerb's
  150. ioHasFormat            EQU        0
  151. ioReadFormat        EQU        1
  152. ioNewFormat            EQU        2
  153. ioWriteFormat        EQU        3
  154.  
  155. FormatIOParamBlock    RECORD 0
  156. ioRefNum            DS.L    1                    ;    LONGINT
  157. format                DS.B    4                    ;     FormatType
  158. formatIndex            DS.L    1                    ;    LONGINT
  159. offset                DS.L    1                    ;     LONGINT
  160. buffPtr                DS.L    1                    ;    Ptr
  161. buffLen                DS.L    1                    ;    LONGINT
  162. size                EQU        *
  163.                     ENDR
  164.  
  165.  
  166. ; EditionOpenerVerb's
  167. eoOpen                EQU        0
  168. eoClose                EQU        1
  169. eoOpenNew            EQU        2
  170. eoCloseNew            EQU        3
  171. eoCanSubscribe        EQU        4
  172.  
  173. EditionOpenerParamBlock RECORD 0
  174. info                DS        EditionInfoRecord    ;
  175. sectionH            DS.L    1                    ;    SectionHandle
  176. document            DS.L    1                    ;    FSSpecPtr
  177. fdCreator            DS.B    4                    ;    OSType
  178. ioRefNum            DS.L    1                    ;    LONGINT
  179. ioProc                DS.L    1                    ;     FormatIOProcPtr
  180. success                DS.B    1                    ;    BOOLEAN
  181. formatsMask            DS.B    1                    ;    SignedByte    
  182. size                EQU        *
  183.                         ENDR
  184.  
  185.  
  186. ; Section Events
  187. sectionEventMsgClass    EQU     'sect'
  188. sectionReadMsgID        EQU     'read'
  189. sectionWriteMsgID        EQU     'writ'
  190. sectionScrollMsgID        EQU     'scrl'
  191. sectionCancelMsgID        EQU     'cncl'
  192.     
  193. ;    Section events now arrive in the message buffer using the AppleEvent format.
  194. ;    The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  195. ;    ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  196. ;    The following is a sample buffer
  197. ;    
  198. ;    name            offset    contents
  199. ;    ----            ------    --------
  200. ;    
  201. ;    header            0        'aevt'
  202. ;    majorVersion    4        $01
  203. ;    minorVersion    6        $01
  204. ;    endOfMetaData    8        ';;;;' 
  205. ;    directObjKey    12        '----' 
  206. ;    paramType        16        'tid ' 
  207. ;    paramLength        20        $0008 
  208. ;    tempIDType        24        'sect' 
  209. ;    tempID             28        the SectionHandle <-- this is want you want
  210. ;
  211.  
  212.     
  213. ;    FUNCTION InitEditionPack: OSErr;
  214.         MACRO
  215.         _InitEditionPack
  216.         MOVE.W     #$0011,-(SP)
  217.         MOVE.W     #$0100,D0
  218.         _Pack11
  219.         ENDM
  220.  
  221.  
  222. ;    FUNCTION NewSection(container: EditionContainerSpec;
  223. ;                        sectionDocument: FSSpecPtr; 
  224. ;                        kind: SectionType;
  225. ;                        sectionID: LONGINT;
  226. ;                        initalMode: UpdateMode; 
  227. ;                        VAR sectionH: SectionHandle): OSErr;
  228.         MACRO
  229.         _NewSection
  230.         MOVE.W     #$0A02,D0
  231.         _Pack11
  232.         ENDM
  233.  
  234.     
  235. ;    FUNCTION RegisterSection(sectionDocument: FSSpec; sectionH: SectionHandle;
  236. ;                            VAR aliasWasUpdated: BOOLEAN): OSErr;
  237.         MACRO
  238.         _RegisterSection
  239.         MOVE.W     #$0604,D0
  240.         _Pack11
  241.         ENDM
  242.  
  243.     
  244.  
  245. ;    FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  246.         MACRO
  247.         _UnRegisterSection
  248.         MOVE.W     #$0206,D0
  249.         _Pack11
  250.         ENDM
  251.  
  252.  
  253.  
  254. ;    FUNCTION IsRegisteredSection(sectionH: SectionHandle): OSErr;
  255.         MACRO
  256.         _IsRegisteredSection
  257.         MOVE.W     #$0208,D0
  258.         _Pack11
  259.         ENDM
  260.  
  261.  
  262.     
  263. ;    FUNCTION AssociateSection(sectionH: SectionHandle; newSectionDocument: FSSpecPtr): OSErr;
  264.         MACRO
  265.         _AssociateSection
  266.         MOVE.W     #$040C,D0
  267.         _Pack11
  268.         ENDM
  269.  
  270.     
  271. ;    FUNCTION CreateEditionContainerFile(editionFile: FSSpec; fdCreator: OSType;
  272. ;                                        editionFileNameScript: ScriptCode): OSErr;
  273.         MACRO
  274.         _CreateEditionContainerFile
  275.         MOVE.W     #$050E,D0
  276.         _Pack11
  277.         ENDM
  278.     
  279.     
  280. ;    FUNCTION DeleteEditionContainerFile(editionFile: FSSpec): OSErr;
  281.         MACRO
  282.         _DeleteEditionContainerFile
  283.         MOVE.W     #$0210,D0
  284.         _Pack11
  285.         ENDM
  286.     
  287.         
  288.     
  289. ;    FUNCTION OpenEdition(subscriberSectionH: SectionHandle; 
  290. ;                            VAR refNum: EditionRefNum): OSErr;
  291.         MACRO
  292.         _OpenEdition
  293.         MOVE.W     #$0412,D0
  294.         _Pack11
  295.         ENDM
  296.     
  297.     
  298. ;    FUNCTION OpenNewEdition(publisherSectionH: SectionHandle; fdCreator: OSType;
  299. ;                            publisherSectionDocument: FSSpecPtr;
  300. ;                            VAR refNum: EditionRefNum): OSErr;
  301.         MACRO
  302.         _OpenNewEdition
  303.         MOVE.W     #$0814,D0
  304.         _Pack11
  305.         ENDM
  306.     
  307.     
  308. ;    FUNCTION CloseEdition(whichEdition: EditionRefNum; successful: BOOLEAN): OSErr;
  309.         MACRO
  310.         _CloseEdition
  311.         MOVE.W     #$0316,D0
  312.         _Pack11
  313.         ENDM
  314.  
  315.  
  316. ;    FUNCTION EditionHasFormat(whichEdition: EditionRefNum; whichFormat: FormatType;
  317. ;                                VAR formatSize: Size): OSErr;
  318.         MACRO
  319.         _EditionHasFormat
  320.         MOVE.W     #$0618,D0
  321.         _Pack11
  322.         ENDM
  323.     
  324.     
  325. ;    FUNCTION ReadEdition(whichEdition: EditionRefNum; whichFormat: FormatType;
  326. ;                            buffPtr: Ptr; VAR buffLen: Size): OSErr;
  327.         MACRO
  328.         _ReadEdition
  329.         MOVE.W     #$081A,D0
  330.         _Pack11
  331.         ENDM
  332.     
  333.     
  334. ;    FUNCTION WriteEdition(whichEdition: EditionRefNum; whichFormat: FormatType;
  335. ;                            buffPtr: Ptr; buffLen: Size): OSErr;
  336.         MACRO
  337.         _WriteEdition
  338.         MOVE.W     #$081C,D0
  339.         _Pack11
  340.         ENDM
  341.     
  342.     
  343. ;    FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType;
  344. ;                                VAR currentMark: LONGINT): OSErr;
  345.         MACRO
  346.         _GetEditionFormatMark
  347.         MOVE.W     #$061E,D0
  348.         _Pack11
  349.         ENDM
  350.     
  351.     
  352. ;    FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum; whichFormat: FormatType;
  353. ;                                setMarkTo: LONGINT): OSErr;
  354.         MACRO
  355.         _SetEditionFormatMark
  356.         MOVE.W     #$0620,D0
  357.         _Pack11
  358.         ENDM
  359.  
  360.  
  361.  
  362. ;    FUNCTION GetEditionInfo(sectionH: SectionHandle; VAR editionInfo: EditionInfoRecord): OSErr;
  363.         MACRO
  364.         _GetEditionInfo
  365.         MOVE.W     #$0422,D0
  366.         _Pack11
  367.         ENDM
  368.         
  369.         
  370. ;    FUNCTION GoToPublisherSection(container: EditionContainerSpec): OSErr;
  371.         MACRO
  372.         _GoToPublisherSection
  373.         MOVE.W     #$0224,D0
  374.         _Pack11
  375.         ENDM
  376.     
  377.     
  378. ;    FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;    
  379.         MACRO
  380.         _GetLastEditionContainerUsed
  381.         MOVE.W     #$0226,D0
  382.         _Pack11
  383.         ENDM
  384.         
  385.         
  386. ;    FUNCTION GetStandardFormats(container: EditionContainerSpec; VAR previewFormat: FormatType;
  387. ;                                    preview, publisherAlias, formats: Handle): OSErr;
  388.         MACRO
  389.         _GetStandardFormats
  390.         MOVE.W     #$0A28,D0
  391.         _Pack11
  392.         ENDM
  393.     
  394.  
  395. ;    FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerProcPtr): OSErr;
  396.         MACRO
  397.         _GetEditionOpenerProc
  398.         MOVE.W     #$022A,D0
  399.         _Pack11
  400.         ENDM
  401.         
  402.  
  403. ;    FUNCTION SetEditionOpenerProc(opener: EditionOpenerProcPtr): OSErr;
  404.         MACRO
  405.         _SetEditionOpenerProc
  406.         MOVE.W     #$022C,D0
  407.         _Pack11
  408.         ENDM
  409.  
  410.  
  411. ;    FUNCTION CallEditionOpenerProc(selector: EditionOpenerVerb; VAR PB: EditionOpenerParamBlock;
  412. ;                            routine: EditionOpenerProcPtr): OSErr;
  413.         MACRO
  414.         _CallEditionOpenerProc
  415.         MOVE.W     #$052E,D0
  416.         _Pack11
  417.         ENDM
  418.  
  419.  
  420. ;    FUNCTION CallFormatIOProc(selector: FormatIOVerb; VAR PB: FormatIOParamBlock;
  421. ;                            routine: FormatIOProcPtr): OSErr;
  422.         MACRO
  423.         _CallFormatIOProc
  424.         MOVE.W     #$0530,D0
  425.         _Pack11
  426.         ENDM
  427.             
  428.  
  429.  
  430.  
  431. ;    FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  432.         MACRO
  433.         _NewSubscriberDialog
  434.         MOVE.W     #$0232,D0
  435.         _Pack11
  436.         ENDM
  437.     
  438.     
  439. ;    FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply; where: Point;
  440. ;                                    expansionDITLresID: INTEGER; dlgHook: ExpDlgHookProcPtr;
  441. ;                                    filterProc: ExpModalFilterProcPtr; yourDataPtr: UNIV Ptr): OSErr;
  442.         MACRO
  443.         _NewSubscriberExpDialog
  444.         MOVE.W     #$0B34,D0
  445.         _Pack11
  446.         ENDM
  447.     
  448.     
  449. ;    FUNCTION NewPublisherDialog(VAR reply: NewPublisherReply): OSErr;
  450.         MACRO
  451.         _NewPublisherDialog
  452.         MOVE.W     #$0236,D0
  453.         _Pack11
  454.         ENDM
  455.     
  456.     
  457. ;    FUNCTION NewPublisherExpDialog(VAR reply: NewPublisherReply; where: Point;
  458. ;                                    expansionDITLresID: INTEGER; dlgHook: ExpDlgHookProcPtr;
  459. ;                                    filterProc: ExpModalFilterProcPtr; yourDataPtr: UNIV Ptr): OSErr;
  460.         MACRO
  461.         _NewPublisherExpDialog
  462.         MOVE.W     #$0B38,D0
  463.         _Pack11
  464.         ENDM
  465.     
  466.     
  467. ;    FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  468.         MACRO
  469.         _SectionOptionsDialog
  470.         MOVE.W     #$023A,D0
  471.         _Pack11
  472.         ENDM
  473.     
  474.     
  475. ;    FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply; where: Point;
  476. ;                                    expansionDITLresID: INTEGER; dlgHook: ExpDlgHookProcPtr;
  477. ;                                    filterProc: ExpModalFilterProcPtr; yourDataPtr: UNIV Ptr): OSErr;
  478.         MACRO
  479.         _SectionOptionsExpDialog
  480.         MOVE.W     #$0B3C,D0
  481.         _Pack11
  482.         ENDM
  483.         
  484.  
  485.  
  486.     ENDIF    ; ...already included